package com.kikt.commontools.util;

import android.annotation.SuppressLint;
import android.content.Context;
import android.widget.Toast;

/**
 * Created by kikt on 2016/10/14.
 */

public class ToastUtils {

    private static Toast toast;

    @SuppressLint("ShowToast")
    public static void initToastUtils(Context context) {
        Context applicationContext = context.getApplicationContext();
        toast = Toast.makeText(applicationContext, "", Toast.LENGTH_SHORT);
    }

    public static void toast(String text) {
        toast.setText(text);
        toast.setDuration(Toast.LENGTH_SHORT);
        toast.show();
    }

    public static void toast(int text) {
        toast.setText(text);
        toast.setDuration(Toast.LENGTH_SHORT);
        toast.show();
    }

    public static void toast(String text, int duration) {
        toast.setText(text);
        toast.setDuration(duration);
        toast.show();
    }

    public static void toast(int text, int duration) {
        toast.setText(text);
        toast.setDuration(duration);
        toast.show();
    }
}
